package com.lt.bookkeeping;

import android.app.Application;
import android.database.sqlite.SQLiteDatabase;

import com.it.bookkeeping.greendao.DaoMaster;
import com.it.bookkeeping.greendao.DaoSession;

/**
 * 数据库Application
 * @author LiuTong
 */
public class DataBaseApplication extends BaseApplication {
    private DaoSession daoSession;
    @Override
    public void onCreate() {
        super.onCreate();
        initDao();
    }
    private void initDao(){
        DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(this,"bookkeeping.db");
        SQLiteDatabase db = devOpenHelper.getWritableDatabase();
        DaoMaster daoMaster = new DaoMaster(db);
        daoSession = daoMaster.newSession();
    }
    public DaoSession getDaoSession(){
        return daoSession;
    }

}
